Rendering of cubic bezier curves in a graphics processing unit (gpu)

ABSTRACT

Techniques are disclosed for a graphics processing unit (GPU) to process cubic Bezier curves, and render the cubic Bezier curves. In an example, the GPU receives a cubic Bezier curve. For example, a graphics pipeline of the GPU receives a plurality of corner points of a control polygon in the form of a patch primitive, the control polygon representing the cubic Bezier curve. The graphics pipeline tessellates the cubic Bezier curve into multiple quadratic Bezier curves, such that the multiple quadratic Bezier curves approximate the cubic Bezier curve. The number of quadratic Bezier curves generated in such a manner is adaptively based on a zoom level at which the cubic Bezier curve is to be displayed. For example, as and when the zoom level changes, new number of such quadratic Bezier curves are tessellated from the cubic Bezier curve. The quadratic Bezier curves are then rendered for display.

FIELD OF THE DISCLOSURE

This disclosure relates generally to digital image processing, and morespecifically to techniques for rendering cubic Bezier curves.

BACKGROUND

Bezier curves are an integral part of vector graphics. For example,curved lines in vector graphics are often represented using cubic Beziercurves. As discussed in further detail herein later, there are manynon-trivial challenges in efficiently rendering cubic Bezier curves fordisplay.

SUMMARY

Techniques are disclosed for rendering a cubic Bezier curve in aGraphics Processing Units (GPU). In some embodiments, a graphicspipeline of the GPU is programmed or otherwise configured to receive acubic Bezier curve, and split the cubic Bezier curve into multiplequadratic Bezier curves. In some embodiments, to split the cubic Beziercurve into multiple quadratic Bezier curves, the GPU generates aplurality of vertices on the cubic Bezier curve, where the plurality ofvertices divides the cubic Bezier curve into a plurality of segments.Subsequently, the GPU generates the plurality of quadratic Beziercurves, wherein each individual quadratic Bezier curve of the pluralityof quadratic Bezier curves (i) is between corresponding two consecutivevertices of the plurality of vertices and (ii) approximates acorresponding segment of the plurality of segments of the cubic Beziercurve. In some embodiments, the cubic-to-quadratic subdivision isexecuted on the GPU hardware by multiple cores in parallel. The multiplequadratic Bezier curves collectively approximate the cubic Bezier curve.Subsequently, the GPU renders the plurality of quadratic Bezier curvesfor display.

For example, assume that “K” quadratic Bezier curves are generated fromthe cubic Bezier curve. In some embodiments, the number K of quadraticBezier curves is computed by the GPU, based on a resolution or zoomlevel at which the Bezier curve is to be displayed. Thus, thecubic-to-quadratic subdivision is executed in real time on GPU hardwareby multiple cores in parallel, as and when the user modifies the zoomlevel. Accordingly, the cubic Bezier curve is approximated by differentnumber of multiple quadratic Bezier curves at different zoom levels,without any loss in accuracy.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram schematically illustrating selected componentsof an example computing device configured to process and render cubicBezier curves on a GPU of the computing device, in accordance with someembodiments of the present disclosure.

FIG. 2A illustrates an example of a cubic Bezier curve, and FIG. 2Billustrates a control polygon of the cubic Bezier curve of FIG. 2A.

FIG. 3A illustrates an example of a quadratic Bezier curve, and FIG. 3Billustrates a control polygon of the quadratic Bezier curve of FIG. 3A.

FIG. 4 is a block diagram schematically illustrating selected componentsof a GPU configured to process and render cubic Bezier curves, inaccordance with some embodiments of the present disclosure.

FIGS. 5A1, 5A2, 5B, 5C, 5D, 5E, 5F, 5G, 5H, and 5I illustrate exampleimages depicting a manner in which a GPU renders a cubic Bezier curve,in accordance with some embodiments of the present disclosure.

FIG. 6 illustrates adaptive tessellation by a graphics pipeline of a GPUwhile rendering a Bezier curve at different zoom levels or resolutions,in accordance with various embodiments of the present disclosure.

FIG. 7 is a flowchart illustrating an example method for rendering acubic Bezier curve on a GPU, in accordance with some embodiments of thepresent disclosure.

FIG. 8 is a flowchart illustrating an example method for adaptivelyrendering a cubic Bezier curve on a GPU, based on a zoom level withwhich the cubic Bezier curves is to be displayed, in accordance withsome embodiments of the present disclosure.

DETAILED DESCRIPTION

Techniques are disclosed for rendering a cubic Bezier curve in aGraphics Processing Units (GPU). In an embodiment, a graphics pipelineof the GPU is programmed or otherwise configured to receive a cubicBezier curve, and split the cubic Bezier curve into multiple quadraticBezier curves. This cubic-to-quadratic subdivision is executed on GPUhardware by multiple cores in parallel. The multiple quadratic Beziercurves collectively approximate the cubic Bezier curve. The multiplequadratic Bezier curves are then rendered in the GPU. Advantageously,operations associated with splitting the cubic Bezier curve intomultiple quadratic Bezier curves are performed entirely within the GPU.No Central Processing Unit (CPU) based preprocessing is needed.

General Overview

In vector graphics, Bezier curves are used to model smooth curves thatcan be scaled indefinitely. Types of Bezier curves include cubic Beziercurves and quadratic Bezier curves. A cubic Bezier curve is defined byfour points in a plane, such as a start point, an end point, and twocontrol points. Locations of these four points define the shape of thecubic Bezier curve. In contrast, a quadratic Bezier curve is defined bythree points in a plane, such as a start point, an end point, and onecontrol point. Locations of these three points define the shape of thequadratic Bezier curve.

Stroking of cubic Bezier curves is a common operation in creativeworkflows, where the goal is to generate another Bezier curve at a fixedoffset from a given Bezier curve, but the process of rendering suchstroked Bezier curves is computationally expensive and slows down thecreative content creation process. In more detail, computationassociated with displaying graphics, such as displaying Bezier curves,is shared between one or more Central Processing Units (CPUs) and one ormore GPUs. For instance, techniques for rendering a cubic Bezier curveinvolve a pre-processing step of approximating a cubic Bezier curve bymultiple lower degree Bezier curves, such as quadratic Bezier curves orlines. This pre-processing step is executed on CPUs. Such CPU-basedpre-processing necessitates data transfer between CPU and GPU memoriesand is a major performance bottleneck in real time vector editingoperations. The bottleneck manifests to the user in terms of slowerrendering times, which can diminish a creator's user-experience. Inparticular, there may be a non-trivial delay between the artist's strokeon a given canvas and the time that stroke is actually rendered on theartist's display, and/or non-trivial delay between zooming in and/orzooming out an image. Thus, the creative process is slowed or otherwiseencumbered.

As discussed herein previously, a cubic Bezier curve has two controlpoints, whereas a quadratic Bezier curve has a single control point.Since a cubic Bezier curve has more control points than a quadraticBezier curve, a cubic Bezier curve is more flexible in the path it takesbetween the two end points, relative to a quadratic Bezier curve.However, as noted above, there are non-trivial issues associated withtechniques for rendering cubic Bezier curve.

For instance, in one such technique, a cubic Bezier curve is flattenedinto straight lines and the resulting lines are rendered on a GPU usingantialiasing techniques. The flattening is executed on a CPU and theresulting lines are then uploaded to the GPU for rendering. For correctappearance of the curve, the curve should be flattened at eachresolution level which results in rendering Bezier curves at arelatively very low frame rate. Such a technique may be optimized byembedding some of processing in a graphics pipeline using tessellationshaders, but there still remains a GPU hardware limitation oftessellating into 64 subdivisions. Given this hardware-based constraintof the GPU, CPU processing is still required at each resolution level tosplit the curve into multiple curves such that each curve can beapproximated by 64 or less lines. So, CPU processing remains aperformance bottleneck for such techniques. Furthermore, as the inputcubic Bezier curve is flattened into straight lines, such straight linesin combination may not fully approximate the cubic Bezier curve,especially at higher zoom level. Thus, the final display of the curve ata higher zoom level may appear to be a collection of multiple straightlines, which may not be visually appealing. For example, for relativelyhigher zoom level, the approximation error may be visible to a user, andthe rendered curve may not appear smooth enough to a user. Anotherpossible technique includes approximating cubic Beziers into quadraticBeziers. In such a technique, a cubic Bezier curve is approximated bymultiple quadratic Beziers in a CPU, and the quadratic Beziers areuploaded to the GPU for rendering. This technique generates bettervisible results than the above discussed flattening technique, as thecubic Bezier is approximated now using multiple quadratic Beziers. Inthis technique, cubic Beziers are split into quadratic Beziers onlyonce, cached and then re-rendered at various zoom levels or resolutionlevels. However, the technique does not perform well in editingoperations as needed in any creative tool. For example, because thecubic Bezier is split into multiple quadratic Beziers only once and thesame splitting is used for all zoom levels (i.e., the splitting is notrepeated for individual zoom levels), any approximation error betweenthe cubic Bezier and multiple quadratic Beziers may be visible,especially at higher zoom level. For example, for relatively higher zoomlevel, the approximation error may be visible to a user, and therendered curve may not appear smooth enough to a user. Furthermore,caching the multiple quadratic Beziers is memory inefficient. Moreover,such splitting of the cubic Bezier into multiple quadratic Beziers isperformed in the CPU. Another possible technique includes directlyrendering cubic Bezier curves on GPU hardware. However, such a solutionagain involves a complex preprocessing step executed on the GPU thatinvolves classifying cubic Beziers into serpentine, cusp and loop andthen computing the coefficients of algebraic form based on curveclassification. Also, the computed coefficients have to be sent to GPUmemory for evaluating the curve in the fragment shader stage of aprogrammable graphics pipeline, which increases CPU-to-GPU data transfertime.

Thus, techniques are provided herein to efficiently render cubic Bezierstrokes. The techniques are particularly well-suited for rendering thincubic Bezier strokes. As used herein, a thin cubic Bezier stroke is astroke having a width of one device pixel or less. In an exampleembodiment, a GPU receives an input cubic Bezier curve, and splits thatcubic Bezier curve into a plurality of quadratic Bezier curves thatapproximate the cubic Bezier curve. This splitting is also referred toherein as tessellation, and is accomplished by leveraging parallelism ofa multi-core GPU.

According to an embodiment, assume that “K” quadratic Bezier curves aregenerated from the cubic Bezier curve. Although the K quadratic Beziercurves collectively approximate the cubic Bezier curve, there may besome error between the quadratic Bezier curves and the cubic Beziercurve (e.g., the quadratic Bezier curves may not exactly overlap thecubic Bezier curve). Such small error is acceptable, as long as theerror is less than a threshold value. The error can be decreased byincreasing the number K of quadratic Bezier curves used forapproximating the cubic Bezier curve, although this may increasecomputational load and/or computational time for rendering the cubicBezier curve. In some such embodiments, the number K of quadratic Beziercurves is computed by the GPU, based on a resolution or zoom level atwhich the Bezier curve is to be displayed. For example, if the Beziercurve is to be displayed at a relatively higher zoom level, a relativelyhigher value of K is selected; and if the Bezier curve is to bedisplayed at a relatively lower zoom level, a relatively lower value ofK is selected.

For example, a user can choose to display the cubic Bezier curve at aninitial zoom level. Thus, an initial value K1 is calculated based on theinitial zoom level and the cubic Bezier curve is split into K1 number ofquadratic Bezier curves, and the K1 number of quadratic Bezier curvesare rendered and displayed. However, if user changes the zoom level, anupdated value K2 is calculated, the cubic Bezier curve is split into K2number of quadratic Bezier curves, and the K2 number of quadratic Beziercurves are rendered and displayed. That is, as and when the user changesthe zoom level, the number K is updated, the GPU re-splits (orre-tessellates) the cubic Bezier curve into the updated K number ofquadratic Bezier curves, and re-renders the quadratic Bezier curves.Thus, the cubic-to-quadratic subdivision is executed in real time on GPUhardware by multiple cores in parallel, as and when the user modifiesthe zoom level. Thus, the cubic Bezier curve is approximated bydifferent number of multiple quadratic Bezier curves at different zoomlevels, without any loss in accuracy. This change in thecubic-to-quadratic approximation is done “on the fly”, as the user canchange the zoom level multiple times and select any of innumerablepossible zoom levels, as will be discussed in further detail herein.

The tessellation or splitting of the cubic Bezier curve into multiplequadratic Bezier curves is performed in a graphics pipeline of the GPU.In some embodiments, the graphics pipeline (also referred to simply as“pipeline”) can receive primitives, such as lines, triangles, points,and “patches.” A patch is defined as a geometrical shape havingarbitrary number of vertices. For example, a polygon with three, four,five, or higher number of sides can be input to the pipeline as a“patch” primitive. For example, a control polygon of the cubic Beziercurve can be a quadrilateral, and the corner points or vertices of thequadrilateral control polygon of the cubic Bezier curve are input as apatch primitive to the pipeline.

In some embodiments, the generation, processing and/or rendering of theK quadratic Bezier curves, corresponding to the input cubic Beziercurve, are performed in parallel. For example, as will be discussed infurther details, the graphics pipeline of the GPU has several stages,and one or more stages are invoked multiple times for the K quadraticBezier curves. Merely as an example and as will be discussed in furtherdetails, a geometric shader operates in parallel to generate the Kquadratic Bezier curves. Thus, the geometric shader is invoked K times,to at least in part parallelly generate the K quadratic Bezier curves.Hence, two or more of the K quadratic Bezier curves are generated atleast partially simultaneously, i.e., in parallel.

For example, the GPU has multiple execution units (e.g., cores of theGPU), and each execution unit can execute multiple tasks in parallel(e.g., can execute multiple execution threads in parallel). Thus, themultiple execution units of the GPU can execute a plurality of tasks inparallel. The graphics pipeline utilizes this parallelism of the GPU togenerate, process and/or render the K quadratic Bezier curves at leastin part parallelly.

The parallelism is two-fold here. As noted above, given a specific cubicBezier curve, generation, processing and/or rendering of K quadraticBezier curves are performed in parallel. Furthermore, multiple cubicBezier curves are also parallelly processed in the GPU. Thus,parallelism is two-fold—multiple cubic Bezier curves are processedwithin the GPU in parallel, and each cubic Bezier curve is alsoprocessed in parallel. This results in faster and more efficientcomputation.

In some embodiments, a patch primitive representing the cubic Beziercurve is input to a vertex shader of the pipeline. The vertex shaderdetermines properties (e.g., position) of individual vertices of thecontrol polygon, and passes the patch primitive through to atessellation control shader (TCS) of the graphics pipeline of the GPU.The vertices of the control polygon are also referred to herein ascorner points of the control polygon.

The TCS specifies tessellation levels for the control polygon.Tessellation, in its most basic form, is breaking down a polygon intosmaller pieces. For example, a square can be tessellated into twotriangles by splitting the shape along its diagonal. In the context ofthe cubic Bezier curve, the TCS determines the number K of quadraticBezier curves in which the cubic Bezier curve is to be split ortessellated, where K is an appropriate integer, such as two, three,four, or higher. As previously discussed herein, the number K is basedon a zoom level with which the cubic Bezier curve is to be viewed on adisplay, a length of the cubic Bezier curve, and/or a complexity ornature of the cubic Bezier curve.

For example, for a given input cubic Bezier curve, the TCS determinesthe number K of quadratic Bezier curves in which the cubic Bezier curveis to be split or tessellated—thus, the TCS is invoked once for theinput Bezier curve. However, subsequent processing and/or rendering ofindividual ones of the K quadratic Bezier curves corresponding to thecubic Bezier curve are processed in parallel in the GPU.

In order to tessellate or split the cubic Bezier curve into K quadraticBezier curves, a tessellation primitive generator (TPG) of the graphicspipeline of the GPU generates (K+1) number vertices on a straight-linesegment, where the vertices are represented as V′1, V′2, V′(K+1).Subsequently, a tessellation evaluation shader (TES) of the graphicspipeline of the GPU maps the vertices V′ 1, V′2, V′(K+1) on the line tovertices V1, V2, . . . , V(K+1) on the cubic Bezier curve. Thus, the TESdivides the cubic Bezier curve into K segments, using the generatedvertices V1, V2, . . . , V(K+1) that are on the cubic Bezier curve atequal parametric distances.

In some embodiments, the TES or a primitive assembly generates Kstraight-line segments Ll, L2, . . . , LK, with each line between twoconsecutive vertices of the vertices V1, V2, . . . , V(K+1). Thus, the Kstraight-line segments Ll, L2, . . . , LK collectively approximate thecubic Bezier curve.

In some embodiments, the TES is invoked (K+1) times, where eachinvocation of the TES is for processing a corresponding vertex of thevertices V1, V2, . . . , V(K+1). In one such embodiment, the Kstraight-line segments Ll, L2, . . . , LK are generated in parallel bythe TES.

A geometric shader of the graphics pipeline of the GPU receives the Kstraight-line segments Ll, L2, . . . , LK that approximate the cubicBezier curve. The geometric shader is programmed to generate, from eachline segment, a corresponding a quadratic Bezier curve. For example,quadratic Bezier curves Q1, Q2, . . . , QK are respectively generatedfor line segments Ll, L2, . . . , LK. In an example, each quadraticBezier curve Q aims to approximate a corresponding segment of the cubicBezier curve. In some embodiments, the geometric shader also computescontrol points C1, C2, . . . , CK for the quadratic Bezier curves Q1, .. . , QK, respectively, and further computes a corresponding controlpolygon for each of the quadratic Bezier curves Q1, . . . , QK.

In some embodiments, the geometric shader is invoked K times, where eachinvocation of the geometric shader is for generating a corresponding oneof the K quadratic Bezier curves Q1, Q2, . . . , QK. In one suchembodiment, the K quadratic Bezier curves Q1, Q2, . . . , QK aregenerated at least in part in parallel by the geometric shader.

A quadratic Bezier curve Qi (where Qi is any of Q1, . . . , QK) liesentirely inside the corresponding control triangle formed bycorresponding start point Vi, end point V(i+1), and control point Ci.However, it is possible that the quadratic Bezier curve is relativelyclose to the sides of the control triangle. For example, sections of thequadratic Bezier Qi curve near the start and end points may berelatively close, or fully or partially overlap, with the sides of thecontrol triangle. This is because two sides of the control triangle aretangent to the quadratic Bezier curve Qi at the start and end points. Ifthe control triangle is rasterized, this may result in problems of undercoverage, and sections of the quadratic Bezier curve Qi overlapping thecontrol triangle may not be fully rendered. In some embodiments, toovercome this problem of under coverage, the control triangle isexpanded in multiple (such as all) directions, to generate a rectangularbounding box. For example, for a given control triangle, thecorresponding rectangular region is output from the geometry shader forrasterization, where the rectangular region fully encompasses thecontrol triangle. For example, there is a margin “p” between corners ofthe control triangle and the sides of the rectangular region, where themargin p can be one pixel-length, two pixel-length, or higher. Thus, thegeometric shader generates K such rectangular areas for thecorresponding K control triangles.

Continuing with this example embodiment, again, the geometric shader isinvoked K times to generate K such rectangular areas for thecorresponding K control triangles. The generation of K such rectangularareas for the corresponding K control triangles may be performed atleast in part in parallel.

The K such rectangular areas may be transmitted to a rasterizer of thegraphics pipeline, which rasterizes the K quadratic Bezier curves. In anexample, the rasterizer rasterizes the K quadratic Bezier curves atleast in part in parallel.

In some embodiments, a fragment shader of the graphics pipeline receivesthe rasterized multiple quadratic Bezier curves, and renders themultiple quadratic Bezier curves employing any appropriateimplicitization techniques. In some embodiments, the fragment shaderalso employs parallelism in rendering the multiple quadratic Beziercurves. For example, the degree of parallelism is per pixel and/or perfragment at the fragment shader stage of the graphics pipeline.

As noted above, parallelism is employed in processing the Bezier curvesin the GPU. For example, multiple cubic Bezier curves can be parallellyprocessed in the GPU. For example, each cubic Bezier curve is split intomultiple quadratic Bezier curves and rendered, and this process isperformed in parallel for multiple Bezier curves. Additionally, given aspecific cubic Bezier curve, the processing of (K+1) number of vertices,K line segments, K quadratic Bezier curves, and rendering of the Kquadratic Bezier curves may also performed in parallel. Thus,parallelism is two-fold here—multiple cubic Bezier curves may beprocessed within the GPU in parallel, and each cubic Bezier curve mayalso be processed in parallel. This results in faster and more efficientcomputation.

For example, assume two input cubic Bezier curves Ca and Cb that are tobe processed by the graphics pipeline and displayed at the same time.Also assume that the cubic Bezier curve Ca is to be converted into 10quadratic Bezier curves Qa1, . . . , Qa10, and the cubic Bezier curve Cbis to be converted into 8 quadratic Bezier curves Qb1, . . . , Qb8. Eachof the cubic Bezier curves Ca and Cb has four corresponding vertexes.Hence, the vertex shader is invoked four times per cubic Bezier curve,e.g., once for each vertex. Thus, the vertex shader is invoked eighttimes (e.g., four for each cubic Bezier curve), and in parallel. The TCSis invoked twice, once for each input cubic Bezier curve, and inparallel.

As the cubic Bezier curve Ca is to be converted into 10 quadratic Beziercurves, the cubic Bezier curve Ca will have 11 new vertices. Similarly,as the cubic Bezier curve Ca is to be converted into 8 quadratic Beziercurves, the cubic Bezier curve Ca will have 9 new vertices. Thus, theTES is invoked 20 times for the two cubic Bezier curves (i.e., 11 timesfor the cubic Bezier curve Ca, and 9 times for the cubic Bezier curveCb).

There will be a total of 18 quadratic Bezier curves. Accordingly, thegeometric shader is invoked 18 times.

In an example, the 20 invocation of the TES can be at least in part inparallel, and similarly, the 18 invocation of the geometric shader canbe at least in part in parallel. For example, 20 instances of TES, i.e.,20 instances of corresponding threads or kernels, will run at least inpart in parallel for processing the two input cubic Bezier curves Ca andCb. Similarly, 18 instances of geometric shader, i.e., 18 instances ofcorresponding threads or kernels, will run at least in part in parallelfor processing the two input cubic Bezier curves Ca and Cb.

As discussed herein, the GPU includes N number of execution units, whichmay be GPU cores. For the above example, one or more of the N number ofexecution units execute the 20 invocation of the TES at least in part inparallel, and one or more of the N number of execution units execute the18 invocation of the geometric shader at least in part in parallel.merely as an example, a first execution unit and a second execution unitof the GPU can share 18 threads corresponding to the 18 invocation ofthe graphics shader in parallel. In another example, merely the firstexecution unit can parallelly execute the 18 threads corresponding tothe 18 invocation of the graphics shader.

Thus, a real-time graphics pipeline is provided for processing cubicBezier curves, wherein the GPU receives the cubic Bezier curve,tessellates the cubic Bezier curve into multiple quadratic Bezier curvesin a parallel fashion using multiple GPU cores, and renders the multiplequadratic Bezier curves for display. The entire processing is performedby the GPU. For example, advantageously, no CPU-based preprocessingoperations to split the cubic Bezier curve into multiple quadraticBezier curves are needed, thereby freeing the CPU resource for othercomputational processes. Moreover, as the GPU receives the single cubicBezier curve, and not multiple equivalent quadratic Bezier curves, datatransfer between the CPU and the GPU is relatively less, compared tosystems where the CPU splits the cubic Bezier curve into multiplequadratic Bezier curves and transfers the multiple quadratic Beziercurves to the GPU. Thus, the discussed techniques result in the GPUachieving significant performance improvement, reduction in datatransfer, and relatively less GPU memory usage. Numerous variations andembodiments will be appreciated in light of this disclosure.

System Architecture and Example Operations

FIG. 1 is a block diagram schematically illustrating selected componentsof an example computing device 100 (also referred to as device 100)configured to process and render cubic Bezier curves on a GPU 104 of thedevice 100, in accordance with some embodiments. As can be seen, thedevice 100 includes the GPU 104, which receives a cubic Bezier curve120, splits the cubic Bezier curve 120 into multiple quadratic Beziercurves 124 a, 134 b, . . . , 124N, and renders the multiple quadraticBezier curves 124 a, 134 b, . . . , 124N. Thus, as will be discussed infurther detail in turn, splitting of the cubic Bezier curve 120 intomultiple quadratic Bezier curves 124 a, 134 b, . . . , 124N, andsubsequent rendering of the multiple quadratic Bezier curves may beperformed within the GPU 104, e.g., performed exclusively on the GPU104.

For example, advantageously, no preprocessing operations to split thecubic Bezier curve 120 into multiple quadratic Bezier curves may beperformed by a CPU, thereby freeing CPU resource for other computationalprocess. Moreover, as the GPU 104 receives the single cubic Bezier curve120, and not multiple equivalent quadratic Bezier curves, data transferbetween the CPU and the GPU is relatively less. For example, datatransfer between the CPU and the GPU 104 is relatively less compared toa situation where the CPU would split the cubic Bezier curve intomultiple quadratic Bezier curves and transfer the multiple quadraticBezier curves to the GPU.

The device 100 can comprise, for example, a desktop computer, a laptopcomputer, a workstation, an enterprise class server computer, a handheldcomputer, a tablet computer, a smartphone, a set-top box, a gamecontroller, and/or any other computing device that can render vectorimages comprising cubic Bezier curves for display.

In the illustrated embodiment, the device 100 includes various softwaremodules configured to implement various functionalities of the device100, as well as hardware configured to enable such implementation. Thesehardware and software components may include, among other things, aprocessor 132, memory 134, an operating system 136, input/output (I/O)components 138, a communication adaptor 140, data storage module 114,and the GPU 104. An image database 154 (e.g., that comprises anon-transitory computer memory) stores vector images comprising one ormore Bezier curves that are to be rendered on a display 143. A busand/or interconnect 150 is also provided to allow for inter- andintra-device communications using, for example, communication adaptor140. Note that in an example, components like the operating system 136can be software modules that are stored in memory 132 and executable bythe processor 132. The bus and/or interconnect 150 is symbolic of allstandard and proprietary technologies that allow interaction of thevarious functional components shown within the device 100, whether thatinteraction actually take place over a physical bus structure or viasoftware calls, request/response constructs, or any other such inter andintra component interface technologies, as will be appreciated.

In some embodiments, the device 100 comprises a display 143. In someother embodiments, the display 143 is external to, and communicativelycoupled to, the device 100. As the display 143 can be included in thedevice 100 or can be external to the device 100, the display 143 isillustrated using dotted lines in FIG. 1.

Processor 132 can be implemented using any suitable processor, and mayinclude one or more coprocessors or controllers, such as an audioprocessor, to assist in processing operations of the device 100. In someembodiments, the processor 132 comprises one or more CPUs. In someembodiments, memory 134 can be implemented using any suitable type ofdigital storage, such as one or more of a disk drive, solid state drive,a universal serial bus (USB) drive, flash memory, random access memory(RAM), or any suitable combination of the foregoing. Operating system136 may comprise any suitable operating system, such as Google Android,Microsoft Windows, or Apple OS X. As will be appreciated in light ofthis disclosure, the techniques provided herein can be implementedwithout regard to the particular operating system provided inconjunction with device 100, and therefore may also be implemented usingany suitable existing or subsequently-developed platform. Communicationadaptor 140 can be implemented using any appropriate network chip orchipset which allows for wired or wireless connection to a networkand/or other computing devices and/or resource. The device 100 alsoinclude one or more I/O components 138, such as one or more of a tactilekeyboard, a display, a mouse, a touch sensitive display, a touch-screendisplay, a trackpad, a microphone, a camera, scanner, and locationservices. In general, other standard componentry and functionality notreflected in the schematic block diagram of FIG. 1 will be readilyapparent, and it will be further appreciated that the present disclosureis not intended to be limited to any specific hardware configuration.Thus, other configurations and subcomponents can be used in otherembodiments.

In an example, the components of the system 102 are in communicationwith one another or other components of the device 102 using the busand/or interconnect 150, as previously discussed. The components of thesystem 102 can be in communication with one or more other devicesincluding other computing devices of a user, server devices (e.g., cloudstorage devices), licensing servers, or other devices/systems. Althoughthe components of the system 102 are shown separately in FIG. 1, any ofthe subcomponents may be combined into fewer components, such as into asingle component, or divided into more components as may serve aparticular implementation.

FIG. 2A illustrates an example of a cubic Bezier curve 202, and FIG. 2Billustrates a control polygon 215 of the cubic Bezier curve 202 of FIG.2A. In vector graphics, Bezier curves may be used to model smooth curvesthat can be scaled indefinitely, and Bezier curves are integral part ofvector graphics. Cubic Bezier curves, such as the cubic Bezier curve 202of FIG. 2A, may be defined by four points in a plane, such as a startpoint 206, an end point 208, and two control points 240 a, 204 b.Locations of these four points define the shape of the cubic Beziercurve 202. The cubic Bezier curve 202 starts at the start point 206going toward the control point 204 a, and arrives at the end point 208coming from the direction of the control point 204 b. Usually, the cubicBezier curve does not pass through the control points 204 a, 204 b—thesepoints may be there to provide directional information. The distancebetween the control points 204 a, 204 b determines how far and/or howfast the curve moves towards the control point 204 a, before turningtowards the control point 204 b. A control polygon of a Bezier curve isformed by the endpoints of the curve and one or more control points. Thecontrol polygon 215, which is a rectangle, is defined by the four points206, 208, 204 a, 204 b. Thus, given the control polygon 215, the cubicBezier curve 202 can be uniquely derived. In an example, the four points206, 208, 204 a, 204 b form vertices or corner points of the controlpolygon 215.

FIG. 3A illustrates an example of a quadratic Bezier curve 302, and FIG.3B illustrates a control polygon 315 of the quadratic Bezier curve 302of FIG. 3A. Quadratic Bezier curves, such as the quadratic Bezier curve302 of FIG. 3A, may be defined by three points in a plane, such as astart point 306, an end point 308, and one control point 340. Locationsof these three points define the shape of the quadratic Bezier curve302. The quadratic Bezier curve 302 starts at the start point 306 goingtoward the control point 304, and arrives at the end point 308 comingfrom the direction of the control point 304. The control polygon 315,which is a triangle, is defined by the three points 306, 308, 304 a.Thus, given the control polygon 315, the quadratic Bezier curve 302 canbe uniquely derived. In an example, the three points 306, 308, 304 formvertices or corner points of the control polygon 315. Since a cubicBezier curve has more control points (i.e., two control points) than aquadratic Bezier curve, a cubic Bezier curve is more flexible in thepath it takes between the two end points than a quadratic Bezier curve.

As will be discussed in further details, in some embodiments, the GPU104 is configured to render cubic Bezier strokes, including thin cubicBezier strokes. For example, the GPU 104 is configured for parallelcomputation of quadratic Bezier curves that approximate a cubic Beziercurve. For each such computed quadratic Bezier, a coverage area iscomputed to be rasterized on GPU hardware. The coverage area includes anoffset of some predefined pixels (e.g., defined to 1 pixel) around theBezier curve, to ensure that there is no under-coverage where aquadratic Bezier curve is close to its control triangle. Each quadraticBezier is then rendered using implicit representation of quadraticBezier curves.

FIG. 4 is a block diagram schematically illustrating selected componentsof the GPU 104 of the computing device 100 of FIG. 1, where the GPU 104is configured to process and render cubic Bezier curves, in accordancewith some embodiments. In some embodiments, the GPU 104 includesnumerous specialized hardware and/or software components configured tooptimize the speed of rendering graphics output. For example, the GPU104 includes specialized components for rendering three-dimensionalstructures and applying textures to surfaces, although not all suchcomponents are illustrated in FIG. 4. It is contemplated that GPUarchitectures other than the example architecture of FIG. 1 may also besuitable for implementing some aspects of the techniques describedherein.

In some embodiments, the GPU 104 may include a host interface 420configured to communicate with a data source. The GPU 104 receives thecubic Bezier curve 120 from the data source. The data source can be aCPU of the processor 142, the memory 144, the data storage module 154,and/or another suitable electronic computational component external toor internal to the device 100. For example, the data source providesinput data and/or executable program code to the GPU 104. In someembodiments, the host interface 420 permits bi-directional communicationbetween the GPU 104 and the data source.

In some embodiments, the GPU 104 also includes a display interface 428for providing output data to a data target, such as the display 143. Forexample, the GPU 104 drives the display 143 by providing graphics data(e.g., multiple quadratic Bezier curves 124 a, . . . , 124N, renderedfor display) to the display 143.

In some embodiments, the GPU 104 includes memory 424. The GPU memory 424(also sometimes referred to as video memory) comprise, for example,random-access memory (RAM) or another suitable memory type, which isaccessible to other GPU components. In some other embodiments, thememory 424 is external to the GPU 104. In some embodiments, the memory424 stores various types of data and instructions, such as input data tothe GPU 104, output data from the GPU 104, program instructions forperforming various tasks within the GPU 104, etc. In some embodiments,the GPU 104 is also configured to access memory 144 of the device 100via the host interface 420.

In some embodiments, the GPU 104 includes a plurality of execution units404 a, 404 b, . . . , 404N, where N is an appropriate integer. Using theexecution units 404 a, . . . , 404N, the GPU 104 processes a pluralityof tasks in a substantially parallel manner, such that a plurality ofthe execution units 404 a, . . . , 404N may be simultaneously in use.For instance, the execution units 404 processes, in parallel, variouspixels, fragments and/or vectorized RGBA/CMYKA data. As additionalexamples, various shaders, such as a geometry shader 452 of the GPU 104(discussed herein later), processes data, such as different primitives(e.g., triangles) concurrently. In some further embodiments, each of theexecution units 404 a, . . . , 404N may perform tasks independent of theother execution units. In an example, an individual execution unit canprocess various tasks in parallel, e.g., using multiple parallelexecution threads. Additionally, tasks can be shared and executed inparallel among the various execution units 404. The execution units 404are, for example, cores of the GPU 104.

In some embodiments, the GPU 104 comprises a graphics pipeline 432configured to receive the cubic Bezier curve 120, and output renderedversion of the multiple quadratic Bezier curves 124 a, . . . , 124N.Various components of the graphics pipeline 432 may be implemented ashardware components, and/or may be software modules that are stored inthe memory 424 and executable by one or more of the execution units 404a, . . . , 404N.

As illustrated, the GPU 404 comprises a vertex shader 436, atessellation module 438, a geometry shader 452, a rasterizer 456, and afragment shader 460, each of which will be discussed in further detailsherein in turn. In some embodiments, the tessellation module 438comprises a tessellation control shader (TCS) 440, a tessellationprimitive generator (TPG) 444, a tessellation evaluation shader (TES)448, and/or a primitive assembly 450. In some embodiments, some of thecomponents of the graphics pipeline 432 (also referred to herein aspipeline 432) are programmable or configurable to perform certainspecific tasks, as will be discussed herein in further detail. Forexample, one or more of (or each of) the vertex shader 436, TCS 440, TES448, geometry shader 452, and the fragment shader 460 areprogrammable—hence, these components are also referred to herein as“programmable stage” of the GPU 104. In an example, the TPG 444, theprimitive assembly 450, and/or the rasterizer 456 may not be programmedor configured—hence, these components are also referred to herein as“fixed stage” of the GPU 104.

In some embodiments, inputs to the pipeline 432 is in the form ofprimitives 411. In an example, the pipeline 432 can receive basicprimitives, such as lines, triangles, and points, and output the finalgeometry to a display screen, such as the display 143. In an example, inaddition to lines, triangles, and points, the pipeline 432 can alsoreceive “patches” as primitives. A patch is defined as a geometricalshape having arbitrary number of vertices. For example, a polygon withthree, four, five, or higher number of sides can be input to graphicspipeline 432 as a “patch” primitive. The concept of patch primitiveenables the GPU 104 to work with arbitrary shapes within the graphicspipeline 432.

In some embodiments, as the pipeline 432 can receive patch primitives(e.g., in addition to various other basic primitives, such as lines,triangles, and points), the cubic Bezier curve 120 is input to thepipeline 432 as a patch primitive. For example, a control polygon of thecubic Bezier curve 120 can be a quadrilateral (e.g., as discussed withrespect to FIG. 2B), and the quadrilateral control polygon of the cubicBezier curve 120 is input as a patch primitive 411 to the pipeline 432.

In some embodiments, the primitives input to the pipeline 432, includingthe patch primitive 411, is received by the vertex shader 236. Asdiscussed, the patch primitive 411 is a patch defined by the cornerpoints or vertices of the control polygon of the cubic Bezier curve 120.Thus, the vertex shader 436 can receive the four corner points of thecontrol polygon of the cubic Bezier curve 120 as patch primitive. Thepatch primitive 411 is resolution independent, such that should an eventoccur that alters the displayed resolution of the curve on-screen, suchas the zooming-in on the curve by the user, the GPU can render theresolution change using the same patch primitive 411.

FIGS. 5A1, 5A2, 5B, 5C, 5D, 5E, 5F, 5G, 5H, and 5I illustrate imagesdepicting a manner in which the GPU 104 renders a cubic Bezier curve502, in accordance with some embodiments. Illustrated in FIG. 5A1 is thecubic Bezier curve 502, which can be same as the cubic Bezier curve 120of FIG. 4. In FIG. 5A1, the cubic Bezier curve 502 is overlaid on agrid, where the grid is illustrated for purposes of clarity and may notbe associated with the rendering process. As discussed with respect toFIG. 2, the cubic Bezier curve 502 is defined by a quadrilateral controlpolygon 515. The quadrilateral control polygon 515 connects a startpoint 506, an end point 508, and two control points 504 a, 504 b of thecubic Bezier curve 502. The vertex shader 436 of the pipeline 432receives the patch primitive 411, which is the control polygon 515 ofthe cubic Bezier curve 502. In an example, the pipeline 432 (e.g., thevertex shader 436 of the pipeline 432) receives the control polygon 515in the form of its corner points. That is, the vertex shader 436receives the vertices or the control polygon 515 of the cubic Beziercurve 502, where the corner points are illustrated in FIG. 5A2. Thecorner points of the control polygon 515 are the start point 506, theend point 508, and the control points 504 a, 504 b of the cubic Beziercurve 502. The vertex shader 436 determines properties (e.g., position)of individual vertices.

The vertices of the control polygon 515 are also referred to herein ascorner points of the control polygon 515. For example, the corner pointsof the control polygon 515 comprises the start point 506, the end point508, and the control points 504 a, 504 b of the cubic Bezier curve 502.

The TCS 440 is invoked for the corner points of the control polygon 515.The TCS 440 takes an input patch and generates an output patch. Merelyas an example, as the control polygon 515 has four corner points, theTCS 440 is invoked once per patch. The TCS specifies tessellation levelsfor the control polygon 515. The tessellation levels may be assigned topredefined output variables of TCS.

Tessellation, in its most basic form, is breaking down a polygon intofiner pieces. A square can be tessellated into two triangles bysplitting the shape along its diagonal. In the context of the cubicBezier curve 502, the TCS 440 determines a number of quadratic Beziercurves in which the cubic Bezier curve 502 is to be sub-divided orsplit. For example, the cubic Bezier curve 502 represented by the fourcorner points (e.g., which may be the start point 506, control points504 a, 504 b, and end point 508) has to be sub-divided into quadraticBezier curves Q1, Q2, . . . , QK, i.e., “K” number of quadratic Beziercurves, where K is an appropriate integer, such as two, three, four, orhigher. In some embodiments, the TCS 440 computes a number of quadraticBezier curves (i.e., K) into which the input cubic Bezier curve is to besubdivided. For example, a tessellation parameter “Abstract patch” ofthe TCS 440 is set to “isolines”, a tessellation parameter“gl_TessLevelOuter[0]” of the TCS 440 is set to 1, and a tessellationparameter “gl_TessLevelOuter[1]” of the TCS 440 is set to K, implyingthat the input cubic Bezier curve is to be subdivided into K quadraticBezier curves.

The number “K” is computed based on a variety of factors, such asresolution or zoom level (e.g., magnification level) at which the cubicBezier curve 502 is to be displayed (details of resolution dependentcomputation of K is discussed herein later with respect to FIG. 6), alength of the cubic Bezier curve 502, and/or a complexity or nature ofthe cubic Bezier curve 502. For example, the higher the zoom level orresolution of displaying the cubic Bezier curve 502, the higher is thenumber K. Similarly, the higher the length of the cubic Bezier curve502, the higher is the number K.

The TPG 444 generates vertices V′1, V′2, V′(K+1), i.e., (K+1) numbervertices on a line segment 505, based on the number “K” generated by theTCS 440, as illustrated in FIG. 5B. Thus, the TPG 444 generates new(K+1) vertices based on the tessellation parameters output by the TCS440. The (K+1) vertices divides the line segment 505 into K equal-lengthsections. In some embodiments, output type of the TPG 44 is set to“isolines.” By setting the output type of the TPG 444 to isolines, thetessellation module 438 maps the cubic Bezier curve 502 with a singleline 505 starting at x=0 and ending at x=1. It is to be noted that theline segment 505 is a straight line, and does not follow the cubicBezier curve 502.

The TES 448 is invoked once for each generated vertex of the (K+1)number vertices of the line segment 505. For example, the TES 448 isinvoked (K+1) number of times. The TES 448 generates, for each vertex ofthe vertices V′1, V′2, V′(K+1), a corresponding value gl_TessCoord.x.This value represents a distance of the newly generated vertex V′ from astarting point of line 505, i.e., from a point x=0.

For example, for the vertex V′1, the TES 448 generates valuegl_TessCoord.x1, which represents a distance between the vertex V′1 andthe starting point of the line 505 (x=0 point)—in the example of FIG.5B, this value of zero, as the vertex V′1 and the starting point of theline 505 coincides. Similarly, for the vertex V′2, the TES 448 generatesvalue gl_TessCoord.x2, which represents a distance between the vertexV′2 and the starting point of the line 505 (x=0 point). Similarly, forthe vertex V′3, the TES 448 generates value gl_TessCoord.x3, whichrepresents a distance between the vertex V′3 and the starting point ofthe line 505 (x=0 point), and so on.

Subsequently, the TES 448 uses the value of gl_TessCoord.x as parametricvalue ‘t’ and computes the value of a point or vertex lying on the cubicBezier curve 502 at t=gl_TessCoord.x. Thus, as illustrated in FIG. 5C,the TES 448 uses the value gl_TessCoord.x2 of the vertex V′1 on the line505 to compute a vertex V1 on the cubic Bezier curve 502. Similarly, theTES 448 uses the value gl_TessCoord.x2 of the vertex V′2 on the line 505to compute a vertex V2 on the cubic Bezier curve 502.

Thus, at the end of TES stage, there may be (K+1) distinct points(including start and end points), such as vertices V1, V2, . . . ,V(K+1), lying on the cubic Bezier curve 502 at equal parametricdistance. Put differently, the vertices V′1, V′2, V′(K+1) on the line505 is mapped to the vertices V1, V2, . . . , V(K+1) on the cubic Beziercurve 502, as illustrated in FIG. 5C.

In some embodiments, the cubic Bezier curve 502 is approximated using Kstraight-line segments Ll, L2, . . . , LK, with each line between twoconsecutive vertices of the vertices V1, V2, . . . , V(K+1), asillustrated in FIG. 5D. For example, in FIG. 5D, the cubic Bezier curve502 is illustrated using dotted line (e.g., as the cubic Bezier curve502 is not received by the geometry shader 452), and the line segmentsLl, . . . , LK are illustrated using solid lines between the verticesV1, V2, . . . , V(K+1). Thus, the input to the geometry shader 452 maybe the line segments L1, . . . , LK formed using pair of consecutivevertices output from the TES 448. In some embodiments, the line segmentsare formed by the TES 448, while in some other embodiments the linesegments are formed by the primitive assembly 450 between the TES 448and the geometric shader 452.

After the line segments L1, . . . , LK are input to the geometric shader452, the geometric shader 452 is invoked once for each of the linesegments L1, . . . , LK. For example, the geometric shader 452 isinvoked K times. The geometric shader 452 is programmed or configured togenerate, from each line segment, a corresponding a quadratic Beziercurve. For example, as illustrated in FIG. 5E, quadratic Bezier curvesQ1, Q2, . . . , QK are respectively generated for line segments L1, L2,. . . , LK. In FIG. 5E, the cubic Bezier curve 502 is notillustrated—rather, the quadratic Bezier curves Q1, . . . , QKapproximating the cubic Bezier curve 502 is illustrated. In an example,as there are K quadratic Bezier curves Q1, . . . ,QK, the geometricshader 452 is invoked K times. The geometric shader 452, thus, replaceseach of the line segments L1, . . . , LK with a corresponding one of thequadratic Bezier curves Q1, . . . , QK.

Given any two vertices on a cubic Bezier curve and given the start, end,and two control points of the cubic Bezier curve, one or more quadraticBezier curves that approximate portion of the cubic Bezier curve betweenthose two vertices can be generated. Thus, in an example, each quadraticBezier curve Q aims to approximate a corresponding portion of the cubicBezier curve 502. For example, the quadratic Bezier curve Q1 between thevertices V1, V2 approximates a section of the cubic Bezier curve 502between the vertices V1, V2; the quadratic Bezier curve Q2 approximatesa section of the cubic Bezier curve 502 between the vertices V2, V3; thequadratic Bezier curve QK approximates a section of the cubic Beziercurve 502 between the vertices VK, V(K+1); and so on. Thus, thecombination of the quadratic Bezier curves Q1, . . . , QK approximatesthe cubic Bezier curve 502. As discussed, in some embodiments, thegeneration of the quadratic Bezier curves Q1, . . . , QK are performedby the geometric shader 452.

In an example, although the quadratic Bezier curves Q1, . . . , QKapproximate the cubic Bezier curve 502, there may be some error betweenthe quadratic Bezier curves Q1, . . . , QK and the cubic Bezier curve502 (e.g., the quadratic Bezier curves Q1, . . . , QK may not exactlyoverlap the cubic Bezier curve 502). Such small error is acceptable, aslong as the error is less than a threshold value. The error can bedecreased by increasing the number K, where (K+1) is the number ofvertices generated in FIG. 5B. Thus, increasing the number K, and thusincreasing the number of quadratic Bezier curves Q1, . . . , QK,increases a granularity with which the quadratic Bezier curves follow orapproximate the cubic Bezier curve 502.

In some embodiments, the geometric shader 452 also computes controlpoints C1, C2, . . . , CK for the quadratic Bezier curves Q1, . . . ,QK, respectively, as illustrated in FIG. 5F. For example, the controlpoint C1 is computed for the quadratic Bezier curve Q1, the controlpoint C2 is computed for the quadratic Bezier curve Q2, the controlpoint CK is computed for the quadratic Bezier curve QK, and so on. FIG.5F also illustrates control polygons (e.g., which are control triangles)for each of the quadratic Bezier curves Q1, . . . , QK. For example, afirst control triangle for the quadratic Bezier curve Q1 is defined by aline joining vertex V1 and control point C1, a line joining vertex V2and control point C1, and the line segment L1. Put differently, thevertices V1 and V2 form the start and end point of the quadratic Beziercurve Q1, with Cl being the control point—thus, points V1, V2, and Cluniquely define the quadratic Bezier curve Q1. Similar control trianglesmay also be defined for the remaining quadratic Bezier curves.

Thus, the output of the geometric shader 452 includes K quadratic Beziercurves Q1, . . . , QK, which collectively approximate the cubic Beziercurve 502. Thus, the input cubic Bezier curve 502 is split into Kquadratic Bezier curves Q1, . . . , QK. The generation of the Kquadratic Bezier curves Q1, . . . , QK from the cubic Bezier curve 502is performed entirely within the GPU 104, e.g., within the pipeline 432.No pre-preprocessing of the cubic Bezier curve 502 is performed in a CPUto split the cubic Bezier curve 502 into multiple quadratic Beziercurves. The cubic Bezier curve 502 is tessellated into multiplequadratic Bezier curves Q1, . . . , QK, and this tessellation isexecuted on GPU cores (e.g., GPU execution units 404 a, . . . , 404N) ofthe GPU 104 in parallel. Note that parallelism is two-fold here: (i)multiple cubic Bezier curves may be input to the pipeline 432 in asingle draw call, and so, the pipeline 432 is running in parallel oneach patch, i.e., running in parallel on each cubic Bezier curve, and(ii) the pipeline 432 may be executed in parallel for vertices and linesegments corresponding to individual cubic Bezier curves. Putdifferently, the pipeline 432 handles the (K+1) number of vertices, Kline segments, and/or K quadratic Bezier curves of a single input cubicBezier curve in parallel. The pipeline 432 also handles multiple suchcubic Bezier curves in parallel as well. This leads to a two-foldparallelism, leading to faster execution time.

The output of the geometric shader 454 is provided to the rasterizer456. The multiple quadratic Bezier curves Q1, . . . , QK may then berasterized by the rasterizer 456, e.g., in the order in which they wereprovided to the rasterizer 456. The result of rasterizing a primitive isa sequence of “fragments,” which may then be processed by the fragmentshader 460. A fragment is a collection of values produced by therasterizer 456. Each fragment represents a sample-sized segment of arasterized primitive (e.g., where a primitive may be the start and endpoints and the control points of individual ones of the multiplequadratic Bezier curves Q1, . . . , QK). The size covered by a fragmentis related to the pixel area. At least one fragment is produced forevery pixel area covered by the primitive being rasterized. An inputfragment, built by the rasterizer, enters the fragment shader 460. Afterarbitrary processing, the fragment shader 460 writes a number of values.These values represent the output fragment, and this output fragment ispassed along, e.g., for displaying in the display 143.

FIG. 5G illustrates an example quadratic Bezier curve Qi of the multiplequadratic Bezier curves Q1, . . . , QK. The quadratic Bezier curve Qi isdefined by the vertices Vi, V(i+1), and control point Ci, where theindex “i” is a number between 1 and K. Also illustrated is the line Libetween the vertices V1, V(i+1), and a control triangle 580 of thequadratic Bezier curve Qi. As seen in FIG. 5G, a quadratic Bezier curve,such as the quadratic Bezier curve Qi, lies entirely inside the controltriangle 580 formed by its start point Vi, end point V(i+1), and controlpoint Ci. However, it is possible that the quadratic Bezier curve isrelatively close to the sides of the control triangle 580. For example,sections of the quadratic Bezier Qi curve near the start and end pointsmay be relatively close, or fully or partially overlap, with the sidesof control triangle 580. This is because two sides of the controltriangle 580 are tangent to the quadratic Bezier curve Qi at the startand end points.

If the rasterizer 456 rasterizes the control triangle 580, this mayresult in problems of under coverage, where the quadratic Bezier curveQi is relatively close to, or at least partially overlaps with, thesides of the control triangle 580. Thus, if the rasterizer 456rasterizes the control triangle 580, sections of the quadratic Beziercurve Qi overlapping the control triangle 580 may not be fully rendered.

In some embodiments, to overcome this problem of under coverage, thecontrol triangle 580 is expanded in all directions, to generate an axisaligned bounding box, as illustrated in FIG. 5H. For example, thecontrol triangle 580 defines a rectangle 584 (illustrated using dottedlines in FIG. 5H) that passes through the vertices Vi, V(i+1), and thecontrol point Ci. A rectangle 582 is generated, such that the rectangle584 has a clearance of “p” on all sides with respect to the rectangle584. The quadratic Bezier curve Qi is now entirely within the rectangle582. This rectangular region 582 is output from the geometry shader 452for rasterization to the rasterizer 456. The rectangular region 582fully encompasses the control triangle 580, such that there is a margin“p” between corners of the control triangle 580 and the sides of therectangular region 582.

The geometric shader 456 generates the rectangular area 582 as follows.The base of the control triangle 580 is offset by a certain number ofpixels that corresponds to “p” of FIG. 5H. In an example, a base of thecontrol triangle 580 is assumed to be the line Li joining the verticesV1, V(i+1), and an apex of the control triangle 580 is assumed to be thecontrol point Ci. The above discussed offset is in the normal directionto the base of the control triangle 580 and opposite to the apex. Theoffset “p” is pre-defined and usually set to 1 pixel or 2 pixels (e.g.,based on display resolution of the display 143), although the offset canbe higher in some examples. Similar offset is performed on the apex aswell, in a direction opposite the base of the control triangle 580. Theoffset is carried out in horizontal directions as well. Finally, therectangle 582 is computed using the offsets. The geometric shader 452outputs the rectangle 582 in the form on multiple triangular strips.

In some embodiments, once the fragment shader 460 receives therasterized multiple quadratic Bezier curves, the fragment shader 460renders the multiple quadratic Bezier curves employing any appropriateimplicitization technique. Merely as an example, the fragment shader 460computes signed distance of each fragment from a quadratic Bezier curveusing an implicit form of quadratic Bezier, and modulates an alphaparameter based on the signed distance of the pixel from the quadraticBezier curve.

FIG. 5I illustrates a cubic Bezier curve 590, and magnified views 593 a,593 b, 593 c of sections 591 a, 591 b, 591 c of the cubic Bezier curve590 as rendered on a display (e.g., display 143). The sections 591 a,591 b are not on an intersection between two lines of the curve 590,while section 591 c is on an intersection between two lines of the curve590. Antialiasing quality at different sections 591 a, 591 b, 591 c ofthe cubic Bezier curve 590 are respectively illustrated in the magnifiedviews 593 a, 593 b, 593 c. As seen in FIG. 5I, the techniques discussedherein with respect to FIGS. 5A1-5H result in good antialiasingthroughout the Bezier curve. Thus, problem of under-coverage at edges ofthe Bezier curves is avoided.

FIG. 6 illustrates adaptive tessellation by the graphics pipeline 432 ofthe GPU 104 while rendering a Bezier curve 604 at different zoom levelsor resolution levels (where zoom level and resolution is usedinterchangeably herein), in accordance with various embodiments of thepresent disclosure. For example, the curve 604 is rendered at zoomlevels or resolutions R1, R2, and R3, where R1 is higher than R2, and R2is higher than R3 (i.e., R1>R2>R3). As seen, at lower zoom level R3, alength of the curve 604 is relatively small, and relatively lower numberof vertices (e.g., six vertices) may be generated by the tessellationmodule 438. At medium zoom level R2, the length of the curve 604 ismedium, and medium number of vertices (e.g., nine vertices) may begenerated by the tessellation module 438. At high zoom level R1, thelength of the curve 604 is relatively large, and relatively large numberof vertices (e.g., twelve vertices) may be generated by the tessellationmodule 438. Thus, the number K discussed with respect to FIGS. 5A1-5I is5 at resolution level R3, is 8 at resolution level R2, and is 11 atresolution level R3.

As discussed, the tessellation module 438 computes a number of verticesadaptively, and re-computes the number of vertices if needed, based on aresolution at which the curve 604 is being viewed in the display 143. Itis to be noted that the resolutions R1, R2, and R3 are not the displayresolution of the display 143. For example, these are not representativeof whether the display 143 is a 4 k display, a 1080p display, etc.Rather, the resolutions R1, R2, and R3 are the zoom levels ormagnification levels of the curve 604 while being displayed.

FIG. 7 is a flowchart illustrating an example method 700 for rendering acubic Bezier curve on a GPU, such as the GPU 104 of FIGS. 1 and 4, inaccordance with some embodiments of the present disclosure. Method 700can be implemented, for example, using the system architectureillustrated in FIGS. 1 and/or 4, and described herein. However othersystem architectures can be used in other embodiments, as apparent inlight of this disclosure. To this end, the correlation of the variousfunctions shown in FIG. 7 to the specific components and functionsillustrated in FIGS. 1 and 4 is not intended to imply any structuraland/or use limitations. Rather, other embodiments may include, forexample, varying degrees of integration wherein multiple functionalitiesare effectively performed by one system. In another example, multiplefunctionalities may be effectively performed by more than one system.For example, in an alternative embodiment, the primitive assembly 450may be combined with the TES 448.

At 704, a cubic Bezier curve represented by corner points of acorresponding control polygon is received in a GPU, such as the GPU 104.For example, as discussed with respect to FIG. 5A2, the vertex shader436 of the pipeline 432 of the GPU 104 receives the corner points orvertices of the control polygon 515 of the cubic Bezier curve 502. In anexample, the vertex shader 436 of the pipeline 432 receives the cornerpoints as a “patch” primitive, as discussed herein. The corners pointscomprise the start point 506, the end point 508, and one or more controlpoints 504 a, 504 b.

At 706, a zoom level or resolution at which the cubic Bezier curve is tobe displayed is determined, e.g., by the TCS 440. At 708, a number ofquadratic Bezier curves to be used to approximate the cubic Bezier curveis computed, e.g., by the TCS 440. For example, as discussed withrespect to FIG. 5B, the TCS 440 calculates that “K” number of quadraticBezier curves are to be used to approximate the cubic Bezier curve. Thenumber K is based on the resolution or zoom level with which the curveis to be displayed (e.g., as discussed with respect to FIG. 6), a lengthof the curve (e.g., as discussed with respect to FIG. 6), and/or acomplexity of the curve.

At 712, the TPG 444 generates a straight line with K vertices (e.g.,vertices V′1, V′2, V′ (K+1)), as discussed with respect to FIG. 5B.Thus, the straight line is divided in (K+1) segments of equal lengths.

At 716, individual ones of the (K+1) number of vertices of the straightline may be mapped on the cubic Bezier curve, e.g., by the TES 448.Thus, (K+1) discrete points or vertices may now be on the cubic Beziercurve, as discussed with respect to FIG. 5C.

At 720, K line segments may be formed, e.g., by the TES 448 and/or theprimitive assembly 450. Each line segment joins two correspondingconsecutive vertices on the cubic Bezier curve, as discussed withrespect to FIG. 5D. For example, FIG. 5D illustrates the line segmentsL1, L2, . . . , LK. The K line segments may be input to the geometricshader 452.

At 724, for each line segment, a corresponding quadratic Bezier curvemay be generated, e.g., by the geometric shader 452. Thus, a pluralityof quadratic Bezier curves may be generated, with each quadratic Beziercurve approximating a corresponding section of the cubic Bezier curve,as discussed with respect to FIG. 5E.

At 728, for each quadratic Bezier curve, a corresponding controltriangle is generated, such that a plurality of control triangles isgenerated for the plurality of quadratic Bezier curves. For example, thecontrol points of the quadratic Bezier curves may be computed, and thenthe control triangles may be generated, as discussed with respect toFIG. 5F. In an example, the generation of the control triangles areperformed by the geometric shader 452. In an example, operations at 724and 728 are combined—that is, the quadratic Bezier curves are generatedby generating the control points and the control triangles by thegeometric shader 452.

At 732, individual control triangle is expanded in two or moredirections to generate a corresponding rectangular area that fullyencompasses the control triangle. For example, there is a pre-definedmargin “p” between corners of the control triangle and the sides of therectangular area, as discussed with respect to FIG. 5H. In an example, aplurality of such rectangular areas is generated corresponding to theplurality of quadratic Bezier curves. Such expansion ensures thatsections of the quadratic Bezier curve that are relatively near to,fully overlapping and/or at least partially overlapping the controltriangle is correctly rasterized and rendered, and issues ofunder-coverage does not occur. In some embodiments, the expansion isperformed by the geometric shader 452. At 736, the plurality ofrectangular areas is rasterized (e.g., by the rasterizer 456) and theplurality of quadratic Bezier curves may be rendered by the fragmentshader 460.

FIG. 8 is a flowchart illustrating an example method 800 for adaptivelyrendering a cubic Bezier curve on a GPU (such as the GPU 104 of FIGS. 1and 4), based on a zoom level with which the cubic Bezier curves is tobe displayed, in accordance with some embodiments of the presentdisclosure. Method 800 can be implemented, for example, using the systemarchitecture illustrated in FIGS. 1 and/or 4, and described herein.However other system architectures can be used in other embodiments, asapparent in light of this disclosure. To this end, the correlation ofthe various functions shown in FIG. 8 to the specific components andfunctions illustrated in FIGS. 1 and 4 is not intended to imply anystructural and/or use limitations. Rather, other embodiments mayinclude, for example, varying degrees of integration wherein multiplefunctionalities are effectively performed by one system. In anotherexample, multiple functionalities may be effectively performed by morethan one system. For example, in an alternative embodiment, theprimitive assembly 450 may be combined with the TES 448.

At 804 of the method 800, a cubic Bezier curve represented by cornerpoints (e.g., comprising a start point, an end point, and one or morecontrol points) of a corresponding control polygon is received. At 806,a zoom level or resolution at which the cubic Bezier curve is to bedisplayed is determined, e.g., by the TCS 440. At 808, a number “K” ofquadratic Bezier curves to be used to approximate the cubic Bezier curveis computed, where the number K is based at least in part on the zoomlevel. The operations at 804, 806, and 808 may be respectively similarto those at 704, 706, 708 of the method 700, and hence, are notdiscussed in further detail.

At 810, the cubic Bezier curve is rendered, using K quadratic Beziercurves, as discussed with respect to operations at 712, 716, 720, 724,728, 732, and 736 of the method 700 of FIG. 7.

At 812, a different zoom level at which the cubic Bezier curve is to benow displayed is detected. Such a change in the zoom level may be basedon a user trying to change the zoom level (e.g., magnifying orshrinking) portions of the cubic Bezier curve being displayed on thedisplay 143. Accordingly, at 816, the TCS 440 updates the value of “K,”which was originally computed at 808. For example, as discussed withrespect to FIG. 6, an increase in the zoom level results in increasingthe value of K, and vice versa. The method 800 then loops back to 810,where the cubic Bezier curve is re-rendered using the updated value ofK.

Numerous variations and configurations will be apparent in light of thisdisclosure and the following examples.

Example 1. A method for processing in a graphics processing unit (GPU) acubic Bezier curve for display, the method comprising: receiving, at theGPU, a plurality of corner points of a control polygon, the controlpolygon representing the cubic Bezier curve; generating, at the GPU, aplurality of vertices on the cubic Bezier curve, the plurality ofvertices dividing the cubic Bezier curve into a plurality of segments;generating, at least in part in parallel at the GPU, a plurality ofquadratic Bezier curves, wherein an individual quadratic Bezier curve ofthe plurality of quadratic Bezier curves (i) is between correspondingtwo consecutive vertices of the plurality of vertices and (ii)approximates a corresponding segment of the plurality of segments of thecubic Bezier curve; and rendering the plurality of quadratic Beziercurves for display.

Example 2. The method of example 1, further comprising: computing, at aTessellation Control Shader (TCS) of a graphics pipeline of the GPU, anumber of vertices included in the plurality of vertices, wherein thenumber of vertices is based on a resolution with which the cubic Beziercurve is to be displayed.

Example 3. The method of any of examples 1-2, wherein generating theplurality of vertices comprises: determining that the cubic Bezier curveis to be displayed at a first resolution; generating, in response todetermining that the cubic Bezier curve is to be displayed at the firstresolution, the plurality of vertices comprising a first number ofvertices; determining that the cubic Bezier curve is to be re-displayedat a second resolution; and re-generating, in response to determiningthat the cubic Bezier curve is to be re-displayed at the secondresolution, the plurality of vertices comprising a second number ofvertices that is different from the first number of vertices.

Example 4. The method of any of examples 1-3, wherein generating theplurality of quadratic Bezier curves comprises: generating, at aTessellation Evaluation Shader and/or a primitive assembly of a graphicspipeline of the GPU, a plurality of straight-line segments, eachstraight-line segment between corresponding two consecutive vertices ofthe plurality of vertices; receiving, by a geometric shader of thegraphics pipeline of the GPU, the plurality of straight-line segments;and generating, by the geometric shader based on the plurality ofstraight-line segments, the plurality of quadratic Bezier curves, eachquadratic Bezier curve of the plurality of quadratic Bezier curvesrepresented by (i) two corresponding consecutive vertices and (ii) acorresponding control point that is calculated by the geometric shader.

Example 5. The method of example 4, wherein generating, by the geometricshader, the plurality of quadratic Bezier curves comprises: invoking thegeometric shader for at least a first instance and a second instance,wherein invocation of the geometric shader for the first instance is forgeneration of a first quadratic Bezier curve of the plurality ofquadratic Bezier curves, and invocation of the geometric shader for thesecond instance is for generation of a second quadratic Bezier curve ofthe plurality of quadratic Bezier curves, and wherein the invocation ofthe geometric shader for the first instance and the second instance areat least in part performed in parallel and occurs at least in partsimultaneously.

Example 6. The method of example 5, wherein the geometric shader isexecuted at the first instance by a first thread executing on a firstexecution unit of the GPU, and wherein the geometric shader is executedat the second instance by a second thread executing on a secondexecution unit of the GPU.

Example 7. The method of example 5, wherein the geometric shader isexecuted at the first instance by a first thread executing on a firstexecution unit of the GPU, and wherein the geometric shader is executedat the second instance by a second thread executing on the firstexecution unit of the GPU.

Example 8. The method of any of examples 4-7, wherein: a first quadraticBezier curve of the plurality of quadratic Bezier curves is associatedwith a corresponding first straight-line segment of the plurality ofstraight-line segments, such that two vertices on two ends of the firststraight-line segment form a start point and an end point of the firstquadratic Bezier curve.

Example 9. The method of any of examples 4-8, wherein the plurality ofstraight-line segments is generated at least in part in parallel, byparallel invocation of a corresponding plurality of instances of theTessellation Evaluation Shader and/or the primitive assembly.

Example 10. The method of any of examples 1-9, wherein the plurality ofvertices is a first plurality of vertices, and where generating thefirst plurality of vertices on the cubic Bezier curve comprises:generating, at a tessellation primitive generator of a graphics pipelineof the GPU, a straight line comprising a second plurality of vertices;and mapping, at a tessellation evaluation shader of the graphicspipeline of the GPU, an individual vertex of the second plurality ofvertices on the straight line to a corresponding vertex of the firstplurality of vertices on the cubic Bezier curve.

Example 11. The method of any of examples 1-10, wherein rendering theplurality of quadratic Bezier curves for display comprises: computing,by a geometric shader of a graphics pipeline of the GPU, for a firstquadratic Bezier curve of the plurality of quadratic Bezier curves,three vertices defining a control triangle that represents the firstquadratic Bezier curve; expanding, by the geometric shader, the controltriangle in two or more directions to generate an area that fullyencompasses the control triangle, such that there is a pre-definedmargin between corners of the control triangle and the area; andrasterizing and rendering the area.

Example 12. The method of any of examples 1-11, wherein receiving theplurality of corner points defining the control polygon comprises:receiving, at a vertex shader of a graphics pipeline of the GPU, theplurality of corner points as a patch primitive.

Example 13. The method of any of examples 1-12, wherein the plurality ofcorner points of the control polygon comprises a start point of thecubic Bezier curve, an end point of the cubic Bezier curve, and twocontrol points of the cubic Bezier curve.

Example 14. A graphics processing unit comprising: one or more executionunits; and a graphics pipeline executable by the one or more executionunits to: receive a patch primitive associated with a cubic Beziercurve; determine a first zoom level with which the cubic Bezier curve isto be displayed; generate a first number of quadratic Bezier curves fromthe cubic Bezier curve, the first number based on the first zoom level;render the first number of quadratic Bezier curves, to enable display ofthe cubic Bezier curve at the first zoom level; determine a second zoomlevel with which the cubic Bezier curve is to be re-displayed; generatea second number of quadratic Bezier curves from the cubic Bezier curve,the second number based on the second zoom level and different from thefirst number; and render the second number of quadratic Bezier curves,to enable display of the cubic Bezier curve at the second zoom level.

Example 15. The graphics processing unit of example 14, wherein: thefirst zoom level is higher than the second zoom level; and the firstnumber of higher than the second number.

Example 16. The graphics processing unit of any of examples 14-15,wherein the first number and the second number are based on a length ofthe cubic Bezier curve.

Example 17. The graphics processing unit of any of examples 14-16,wherein the patch primitive comprises a start point of the cubic Beziercurve, an end point of the cubic Bezier curve, and two control points ofthe cubic Bezier curve.

Example 18. The graphics processing unit of any of examples 14-17,wherein to generate the first number of quadratic Bezier curves from thecubic Bezier curve, the graphics processing unit is executable to:generate a plurality of vertices on the cubic Bezier curve, theplurality of vertices dividing the cubic Bezier curve into a pluralityof segments, a number of vertices included in the plurality of verticesis a sum of the first number and one; and generate the first number ofquadratic Bezier curves, such that an individual quadratic Bezier curveof the first number of quadratic Bezier curves (i) is betweencorresponding two consecutive vertices of the plurality of vertices and(ii) approximates a corresponding segment of the plurality of segmentsof the cubic Bezier curve.

Example 19. The graphics processing unit of example 18, wherein togenerate the first number of quadratic Bezier curves from the cubicBezier curve, the graphics processing unit is executable to: generate afirst number of straight-line segments, such that an individualstraight-line segment of the first number of straight-line segments isbetween corresponding two consecutive vertices of the plurality ofvertices; and replace each straight-line segment of the first number ofstraight-line segments with a corresponding quadratic Bezier curve ofthe first number of quadratic Bezier curves.

Example 20. The graphics processing unit of any of examples 14-19,wherein the plurality of vertices on the cubic Bezier curve is a firstplurality of vertices, and wherein to generate the first plurality ofvertices on the cubic Bezier curve, the graphics processing unit isexecutable to: generate a straight line comprising a second plurality ofvertices; and map an individual vertex of the second plurality ofvertices on the straight line to a corresponding vertex of the firstplurality of vertices on the cubic Bezier curve.

Example 21. The graphics processing unit of any of examples 14-20,wherein to render the first number of quadratic Bezier curves, thegraphics processing unit is executable to: compute, for a firstquadratic Bezier curve of the first number of quadratic Bezier curves,three vertices defining a control triangle that represents the firstquadratic Bezier curve; expand the control triangle in two or moredirections to generate an area that fully encompasses the controltriangle, such that there is a pre-defined margin corresponding to oneor more display pixels between corners of the control triangle and thearea; and rasterize and render the area.

Example 22. A computer program product including one or morenon-transitory machine-readable mediums encoded with instructions thatwhen executed by one or more processors cause a process to be carriedout by a graphics processing unit (GPU) for processing a cubic Beziercurve for display, the process comprising: receiving a plurality ofcorner points of a control polygon, the control polygon representing thecubic Bezier curve; generating, at least in part in parallel, aplurality of vertices on the cubic Bezier curve that divides the cubicBezier curve into a plurality of segments; generating, at least in partin parallel, a plurality of quadratic Bezier curves, wherein anindividual quadratic Bezier curve of the plurality of quadratic Beziercurves (i) is between corresponding two consecutive vertices of theplurality of vertices and (ii) approximates a corresponding segment ofthe plurality of segments of the cubic Bezier curve; and rendering theplurality of quadratic Bezier curves for display.

Example 23. The computer program product of example 22, wherein theprocess further comprises: computing, at a Tessellation Control Shader(TCS) of a graphics pipeline of the GPU, a number of vertices includedin the plurality of vertices, wherein the number of vertices is based ona resolution with which the cubic Bezier curve is to be displayed.

Example 24. The computer program product of any of examples 22-23,wherein generating the plurality of vertices comprises: generating,while the cubic Bezier curve is to be displayed at a first resolution,the plurality of vertices comprising a first number of vertices; andgenerating, while the cubic Bezier curve is to be re-displayed at asecond resolution, the plurality of vertices comprising a second numberof vertices that is different from the first number of vertices.

Example 25. The computer program product of any of examples 22-24,wherein generating the plurality of quadratic Bezier curves comprises:generating, at a Tessellation Evaluation Shader and/or a primitiveassembly of a graphics pipeline of the GPU, a plurality of straight-linesegments, each straight-line segment between corresponding twoconsecutive vertices of the plurality of vertices; receiving, by ageometric shader of the graphics pipeline of the GPU, the plurality ofstraight-line segments; and generating, by the geometric shader based onthe plurality of straight-line segments, the plurality of quadraticBezier curves, each quadratic Bezier curve of the plurality of quadraticBezier curves represented by (i) two corresponding consecutive verticesand (ii) a corresponding control point that is calculated by thegeometric shader.

Example 26. The computer program product of example 25, wherein: a firstquadratic Bezier curve of the plurality of quadratic Bezier curves isassociated with a corresponding first straight-line segment of theplurality of straight-line segments, such that two vertices on two endsof the first straight-line segment form a start point and an end pointof the first quadratic Bezier curve.

Example 27. The computer program product of any of examples 22-26,wherein the plurality of vertices is a first plurality of vertices, andwhere generating the first plurality of vertices on the cubic Beziercurve comprises: generating, at a tessellation primitive generator of agraphics pipeline of the GPU, a straight line comprising a secondplurality of vertices; and mapping, at a tessellation evaluation shaderof the graphics pipeline of the GPU, each individual vertices of thesecond plurality of vertices on the straight line to correspondingvertices of the first plurality of vertices on the cubic Bezier curve.

Example 28. The computer program product of any of examples 22-27,wherein rendering the plurality of quadratic Bezier curves for displaycomprises: computing, by a geometric shader of a graphics pipeline ofthe GPU, for a first quadratic Bezier curve of the plurality ofquadratic Bezier curves, three vertices defining a control triangle thatrepresents the first quadratic Bezier curve; expanding, by the geometricshader, the control triangle in two or more directions to generate anarea that fully encompasses the control triangle, such that there is apre-defined margin between corners of the control triangle and the area;and rasterizing and rendering the area.

Example 29. The computer program product of any of examples 22-28,wherein receiving the plurality of corner points defining the controlpolygon comprises: receiving, at a vertex shader of a graphics pipelineof the GPU, the plurality of corner points as a patch primitive.

Example 30. The computer program product of any of examples 22-29,wherein the plurality of corner points of the control polygon comprisesa start point of the cubic Bezier curve, an end point of the cubicBezier curve, and two control points of the cubic Bezier curve.

The foregoing detailed description has been presented for illustration.It is not intended to be exhaustive or to limit the disclosure to theprecise form described. Many modifications and variations are possiblein light of this disclosure. Therefore, it is intended that the scope ofthis application be limited not by this detailed description, but ratherby the claims appended hereto. Future filed applications claimingpriority to this application may claim the disclosed subject matter in adifferent manner, and may generally include any set of one or morelimitations as variously disclosed or otherwise demonstrated herein.

1. A method for processing in a graphics processing unit (GPU) a cubicBezier curve for display, the method comprising: receiving, at the GPU,a plurality of corner points of a control polygon, the control polygonrepresenting the cubic Bezier curve; generating, at the GPU, a pluralityof vertices on the cubic Bezier curve, the plurality of verticesdividing the cubic Bezier curve into a plurality of segments;generating, at least in part in parallel at the GPU, a plurality ofquadratic Bezier curves, wherein an individual quadratic Bezier curve ofthe plurality of quadratic Bezier curves (i) is between correspondingtwo consecutive vertices of the plurality of vertices and (ii)approximates a corresponding segment of the plurality of segments of thecubic Bezier curve; and rendering the plurality of quadratic Beziercurves for display.
 2. The method of claim 1, further comprising:computing, at a Tessellation Control Shader (TCS) of a graphics pipelineof the GPU, a number of vertices, wherein the computed number ofvertices is based on a resolution with which the cubic Bezier curve isto be displayed, wherein generation of the plurality of vertices on thecubic Bezier curve is based on the computed number of vertices.
 3. Themethod of claim 1, wherein generating the plurality of verticescomprises: determining that the cubic Bezier curve is to be displayed ata first resolution; generating, in response to determining that thecubic Bezier curve is to be displayed at the first resolution, theplurality of vertices comprising a first number of vertices; determiningthat the cubic Bezier curve is to be re-displayed at a secondresolution; and re-generating, in response to determining that the cubicBezier curve is to be re-displayed at the second resolution, theplurality of vertices comprising a second number of vertices that isdifferent from the first number of vertices.
 4. The method of claim 1,wherein generating the plurality of quadratic Bezier curves comprises:generating, at a Tessellation Evaluation Shader and/or a primitiveassembly of a graphics pipeline of the GPU, a plurality of straight-linesegments, each straight-line segment between corresponding twoconsecutive vertices of the plurality of vertices; receiving, by ageometric shader of the graphics pipeline of the GPU, the plurality ofstraight-line segments; and generating, by the geometric shader based onthe plurality of straight-line segments, the plurality of quadraticBezier curves, each quadratic Bezier curve of the plurality of quadraticBezier curves represented by (i) two corresponding consecutive verticesand (ii) a corresponding control point that is calculated by thegeometric shader.
 5. The method of claim 4, wherein generating, by thegeometric shader, the plurality of quadratic Bezier curves comprises:invoking the geometric shader for at least a first instance and a secondinstance, wherein invocation of the geometric shader for the firstinstance is for generation of a first quadratic Bezier curve of theplurality of quadratic Bezier curves, and invocation of the geometricshader for the second instance is for generation of a second quadraticBezier curve of the plurality of quadratic Bezier curves, and whereinthe invocation of the geometric shader for the first instance and thesecond instance are at least in part performed in parallel and occurs atleast in part simultaneously.
 6. The method of claim 4, wherein: a firstquadratic Bezier curve of the plurality of quadratic Bezier curves isassociated with a corresponding first straight-line segment of theplurality of straight-line segments, such that two vertices on two endsof the first straight-line segment form a start point and an end pointof the first quadratic Bezier curve.
 7. The method of claim 1, whereinthe plurality of vertices is a first plurality of vertices, and wheregenerating the first plurality of vertices on the cubic Bezier curvecomprises: generating, at a tessellation primitive generator of agraphics pipeline of the GPU, a straight line comprising a secondplurality of vertices; and mapping, at a tessellation evaluation shaderof the graphics pipeline of the GPU, an individual vertex of the secondplurality of vertices on the straight line to a corresponding vertex ofthe first plurality of vertices on the cubic Bezier curve.
 8. The methodof claim 1, wherein rendering the plurality of quadratic Bezier curvesfor display comprises: computing, by a geometric shader of a graphicspipeline of the GPU, for a first quadratic Bezier curve of the pluralityof quadratic Bezier curves, three vertices defining a control trianglethat represents the first quadratic Bezier curve; expanding, by thegeometric shader, the control triangle in two or more directions togenerate an area that fully encompasses the control triangle, such thatthere is a pre-defined margin between corners of the control triangleand the area; and rasterizing and rendering the area.
 9. The method ofclaim 1, wherein receiving the plurality of corner points defining thecontrol polygon comprises: receiving, at a vertex shader of a graphicspipeline of the GPU, the plurality of corner points as a patchprimitive.
 10. A graphics processing unit (GPU) comprising: one or moreexecution units; and a graphics pipeline executable by the one or moreexecution units to: receive a patch primitive associated with a cubicBezier curve; determine a first zoom level with which the cubic Beziercurve is to be displayed; generate a first number of quadratic Beziercurves from the cubic Bezier curve, the first number based on the firstzoom level; render the first number of quadratic Bezier curves, toenable display of the cubic Bezier curve at the first zoom level;determine a second zoom level with which the cubic Bezier curve is to bere-displayed; generate a second number of quadratic Bezier curves fromthe cubic Bezier curve, the second number based on the second zoom leveland different from the first number; and render the second number ofquadratic Bezier curves, to enable display of the cubic Bezier curve atthe second zoom level.
 11. The graphics processing unit of claim 10,wherein: the first zoom level is higher than the second zoom level; andthe first number of higher than the second number.
 12. The graphicsprocessing unit of claim 10, wherein the first number and the secondnumber are based on a length of the cubic Bezier curve.
 13. The graphicsprocessing unit of claim 10, wherein the patch primitive comprises astart point of the cubic Bezier curve, an end point of the cubic Beziercurve, and two control points of the cubic Bezier curve.
 14. Thegraphics processing unit of claim 10, wherein to generate the firstnumber of quadratic Bezier curves from the cubic Bezier curve, thegraphics processing unit is executable to: generate a plurality ofvertices on the cubic Bezier curve, the plurality of vertices dividingthe cubic Bezier curve into a plurality of segments, a number ofvertices included in the plurality of vertices is a sum of the firstnumber and one; and generate the first number of quadratic Beziercurves, such that an individual quadratic Bezier curve of the firstnumber of quadratic Bezier curves (i) is between corresponding twoconsecutive vertices of the plurality of vertices and (ii) approximatesa corresponding segment of the plurality of segments of the cubic Beziercurve.
 15. The graphics processing unit of claim 14, wherein to generatethe first number of quadratic Bezier curves from the cubic Bezier curve,the graphics processing unit is executable to: generate a first numberof straight-line segments, such that an individual straight-line segmentof the first number of straight-line segments is between correspondingtwo consecutive vertices of the plurality of vertices; and replace eachstraight-line segment of the first number of straight-line segments witha corresponding quadratic Bezier curve of the first number of quadraticBezier curves.
 16. The graphics processing unit of claim 10, wherein theplurality of vertices on the cubic Bezier curve is a first plurality ofvertices, and wherein to generate the first plurality of vertices on thecubic Bezier curve, the graphics processing unit is executable to:generate a straight line comprising a second plurality of vertices; andmap an individual vertex of the second plurality of vertices on thestraight line to a corresponding vertex of the first plurality ofvertices on the cubic Bezier curve.
 17. The graphics processing unit ofclaim 10, wherein to render the first number of quadratic Bezier curves,the graphics processing unit is executable to: compute, for a firstquadratic Bezier curve of the first number of quadratic Bezier curves,three vertices defining a control triangle that represents the firstquadratic Bezier curve; expand the control triangle in two or moredirections to generate an area that fully encompasses the controltriangle, such that there is a pre-defined margin corresponding to oneor more display pixels between corners of the control triangle and thearea; and rasterize and render the area.
 18. A computer program productincluding one or more non-transitory machine-readable mediums encodedwith instructions that when executed by one or more processors cause aprocess to be carried out by a graphics processing unit (GPU) forprocessing a cubic Bezier curve for display, the process comprising:receiving a plurality of corner points of a control polygon, the controlpolygon representing the cubic Bezier curve; generating, at least inpart in parallel, a plurality of vertices on the cubic Bezier curve thatdivides the cubic Bezier curve into a plurality of segments; generating,at least in part in parallel, a plurality of quadratic Bezier curves,wherein an individual quadratic Bezier curve of the plurality ofquadratic Bezier curves (i) is between corresponding two consecutivevertices of the plurality of vertices and (ii) approximates acorresponding segment of the plurality of segments of the cubic Beziercurve; and rendering the plurality of quadratic Bezier curves fordisplay.
 19. The computer program product of claim 18, wherein theprocess further comprises: computing, at a Tessellation Control Shader(TCS) of a graphics pipeline of the GPU, a number of vertices includedin the plurality of vertices, wherein the number of vertices is based ona resolution with which the cubic Bezier curve is to be displayed. 20.The computer program product of claim 18, wherein generating theplurality of quadratic Bezier curves comprises: generating, while thecubic Bezier curve is to be displayed at a first resolution, theplurality of quadratic Bezier curves comprising a first number ofquadratic Bezier curves; and generating, while the cubic Bezier curve isto be re-displayed at a second resolution, the plurality of quadraticBezier curves comprising a second number of quadratic Bezier curves thatis different from the first number, wherein the first number and thesecond number are respectively based on the first and secondresolutions.